#! /usr/bin/env perl
# author: maxiao
# date: 2023-03-08 15:17
# description: 通过DBI模块来连接mysql数据库

use v5.20;
use strict;
use warnings;
use utf8;

use dbi;

my $data_source = "dbi:mSQL:dbname=myfund";
my $username = "root";
my $password = "gomx1028";
my $dbh = DBI->connect($data_source, $username, $password);
my $sth = $dbh->prepare("SELECT * from list LIMIT 10");
$sth->execute();
my @row_ary = $sth->fetchrow_array;
foreach ( @row_ary ) {
    print "$_\n";
}
$dbh->disconnect();

